/*
 * @Author: Otway
 * @Date: 2019-01-09 11:16:08
 * @LastEditors: Otway
 * @LastEditTime: 2019-08-30 18:50:09
 * @copyright: h-visions
 */
import React, { PureComponent } from 'react';
import {
  Row,
  Col,
  Form,
  Input,
  DatePicker,
  Radio,
  Checkbox
} from 'antd';
const FormItem = Form.Item;
const RadioGroup = Radio.Group;
const RadioButton = Radio.Button;
const CheckboxGroup = Checkbox.Group
const formItemLayout = {
  // 抽屉里面Form。二列的布局比例
  labelCol: {
    span: 4
  },
  wrapperCol: {
    span: 18
  }
};

class AddFrom extends PureComponent {

  changModel = (e) => {
    const {
      form: { getFieldsValue },

      onchangModel
    } = this.props;

    if (onchangModel) {
      onchangModel(getFieldsValue());
    }
  };
  render() {
    const {
      formData,
      operateType,
      form: { getFieldDecorator },
      personList
    } = this.props;
    return (
      <Form >
        <Row>
          <Col span={24}>
            <FormItem {...formItemLayout} label={'账号'}>
              {getFieldDecorator('empower', {
                initialValue: formData.empower || [],
                rules: [
                  {
                    required: true,
                    message: '请选择账号'
                  }
                ]
              })(
                <Checkbox.Group style={{ display: 'flex', justifyContent: 'space-between', flexWrap: 'wrap' }} >
                  {personList && personList.map((item) =>
                    <Checkbox style={{ width: '45%' }} key={item.userId} value={item.userId}>{item.userName}</Checkbox>
                  )}
                </Checkbox.Group>
              )}
            </FormItem>
          </Col>



        </Row>
        {/* <FormItem style={{ visibility: 'hidden' }}>
          {getFieldDecorator('id', {
            initialValue: formData?.id || null,
          })(
            <Input />
          )}
        </FormItem>
     */}
      </Form>
    );
  }
}

export default Form.create()(AddFrom);
